﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using EBSystem.Pages;
using EBSystem.ViewModels;

namespace EBSystem
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public LoginPage ThisLoginPage { get; set; }

        public RegisterPage? ThisRegisterPage { get; set; }

        public UserSourcePage? ThisUserSourcePage { get; set; }

        public BusinessSourcePage? ThisBusinessSourcePage { get; set; }

        public MainWindow()
        {
            InitializeComponent();

            DataContext = new MainViewModel();

            GotoLoginPage();
        }

        static public MainWindow? GetThisMainWindow()
        {
            return Application.Current.MainWindow as MainWindow;
        }

        public void GotoRegisterPage()
        {
            if (ThisRegisterPage is null)
            {
                ThisRegisterPage = new();
            }
            mainContentControl.Content = ThisRegisterPage;
        }

        public void GotoLoginPage()
        {
            if (ThisLoginPage is null)
            {
                ThisLoginPage = new();
            }
            mainContentControl.Content = ThisLoginPage;
        }

        public void GotoUserSourcePage()
        {
            if (ThisUserSourcePage is null)
            {
                ThisUserSourcePage = new();
            }
            mainContentControl.Content = ThisUserSourcePage;
            ThisUserSourcePage.InitializeData();
        }

        public void GotoBusinessSourcePage()
        {
            if (ThisBusinessSourcePage is null)
            {
                ThisBusinessSourcePage = new();
            }
            mainContentControl.Content = ThisBusinessSourcePage;
            ThisBusinessSourcePage.InitializeData();
        }
    }
}
